package com.dmall.ssm.service.impl;

import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import com.dmall.ssm.param.QueryCriterion;
import com.dmall.ssm.request.UserRequestPara;
import com.dmall.ssm.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dmall.ssm.dao.UserDao;
import com.dmall.ssm.pojo.User;
import com.dmall.ssm.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	
	@Override
	public User findById(Integer id) {
		return userDao.findById(id);
	}

	@Override
	public List<User> findAll() {
		return userDao.findAll();
	}

	@Override
	public List<User> findByContains(Integer id, Integer contains) {
		return userDao.findByContains(id, contains);
	}

	@Override
	public List<User> notContains(Integer id) {
		return userDao.notContains(id);
	}

	@Override
	public List<User> findByCriterion(QueryCriterion queryCriterion) {
		return userDao.findByCriterion(queryCriterion);
	}

	@Override
	public CommonResult testHystrix(UserRequestPara para) throws Exception {
		if (true) {
			throw new RuntimeException();
		}
		CommonResult result = new CommonResult();
		result.setCode("0000");
		result.setMsg("success");
		result.setData(new User());
		return result;
	}
}
